import { configureStore } from '@reduxjs/toolkit';

import userStore from '@/store/modules/userStore';
import departmentStore from '@/store/modules/departmentStore';
import roleStore from '@/store/modules/roleStore';
import permissionStore from '@/store/modules/permissionStore';
import employeeStore from '@/store/modules/employeeStore';

const store = configureStore({
  devTools: true,
  reducer: {
    userStore,
    departmentStore,
    roleStore,
    permissionStore,
    employeeStore,
  },
});

// 从store本身推断出' RootState '和' AppDispatch '类型
export type RootState = ReturnType<typeof store.getState>

// 推断类型 type: {posts: PostsState, comments: CommentsState, users: UsersState}
export type AppDispatch = typeof store.dispatch


export default store;
